#ifndef HATERB_H
#define HATERB_H

#include "hater.h"

//#define ZEN_BOOST
#ifdef ZEN_BOOST

#include <boost/shared_ptr.hpp>
#include <boost/cstdint.hpp>
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include <boost/system/error_code.hpp>
#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/noncopyable.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/uuid_generators.hpp>

#include "internal/hlog.h"

namespace Zen
{
namespace utility
{
	using namespace std;
	using namespace ::boost;
	using namespace ::boost::system;
	using namespace ::boost::filesystem;


	string CreateUUID();

	bool RemoveEmptyDir(const string& strPath);
	string NormalizePath(const string& strPath);

	//thread_group.h
	typedef boost::shared_ptr<thread> ThreadSP;
	class ThreadGroup;

	// Process
	struct Process;
	typedef boost::shared_ptr<Process> ProcessSP;
	ProcessSP InvokeProcess(const string& strCmdLine, const string& strCurDir="", bool bShowWindow=true);
	bool WaitForProcess(const ProcessSP pProc, int nMsec);
	bool KillProcess(const ProcessSP pProc, int nExitCode=0);

	string FormatErrorCode(const boost::system::error_code& ec);

	bool rar_exe(const string& strFolderPath, const string& strZipPath, const StringSet& filter, int nLevel=0);
	bool unrar_exe(const string& strFolderPath, const string& strZipPath);

	ostream& Log();
	ostream& Out();
	ostream& Err();
	ostream& TimedLog();
	ostream& TimedOut();
	ostream& TimedErr();
	ostream& LogF();

#define LOG()	base_log(clog)

}//end utility
}//end Zen

#endif
#endif